Column moved [finished] event in JTable
        Posted  
        
            by chown
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by chown
        
        
        
        Published on 2010-01-29T17:46:23Z
        Indexed on 
            2010/06/09
            3:32 UTC
        
        
        Read the original article
        Hit count: 153
        
How should I detect that column moved action is finished in JTable? I've added columnModeListener to my column model but the problem is columnMoved method is called every time a column moves (by certain pixels). I don't want this behavior. I just want to detect when the column dragging is finished.
columnModel.addColumnModelListener(new TableColumnModelListener() {
            public void columnAdded(TableColumnModelEvent e) {
            }
            public void columnRemoved(TableColumnModelEvent e) {
            }
            public void columnMoved(TableColumnModelEvent e) {
                //this is called so many times
                //I don't want this, but something like column moved finished event
                System.out.println("Moved "+e.getFromIndex()+", "+e.getToIndex());
            }
            public void columnMarginChanged(ChangeEvent e) {
            }
            public void columnSelectionChanged(ListSelectionEvent e) {
            }
        });
I hope it is clear what I'm looking for. Thanks.
© Stack Overflow or respective owner